<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<style type="text/css">

a.adminlink:link 
{
	color:#000000;
	text-decoration: none;
}
a.adminlink:VISITED 
{
	color:#000000;
	text-decoration: none;	
}
a.adminlink:ACTIVE 
{
	color:#000000;
	text-decoration: none;
}
a.adminlink:hover
{
	color:#000000;
	text-decoration: none;
}
</style>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.1.0.js"></script>
<script type="text/javascript">
	$(function(){
		var nickFlag=false;
		$("input[name=nick]").keyup(function(){
			var nick=$(this).val()
			$.ajax({
				type:"post",
				url:"nickCheck.do",
				dataType:"json",
				data:"nick="+nick,
				success:function(nvo){
					if(nvo.id==""){
						nickFlag=false;
						$("#nickCheck").html("일치하는 nick이 없습니다!");
					}else{
						nickFlag=true;
						$("#nickCheck").html("nick 일치!   현포인트: "+nvo.floatingPoint);
					}
				}
			});
		});
		$("#updatePointForm").submit(function(){
			if($("input[name=nick]").val()==""){
				alert("nick을 입력하세요!");
				return false;
			}else if($("#operator").val()=="---"){
				alert("+ - 를 선택하세요");
				return false;
			}else if($("input[name=point]").val()==""){
				alert("point를 입력하세요!");
				return false;
			}else if(isNaN($("input[name=point]").val())){
				alert("숫자를 입력하세요!");
				return false;
			}else if(nickFlag==false){
				alert("존재하지 않는 nick입니다.");
				return false;
			}
		});
		$("#admin td").hover(function(){
				$(this).css("background","gray");
			},function(){
				$(this).css("background","white");
			});
	});
</script>
</head>
<body>
<h2 align="center">관리자 페이지</h2>
<br>
<table align="center" id="admin">
	<tr>
		<td><a href = "${initParam.root }/admin_member.do" class="adminlink">회원관리</a></td>
		<td><a href = "${initParam.root}/admin_point.do" class="adminlink">포인트 증감</a></td>
		<td><a href = "${initParam.root}/admin_post.do" class="adminlink">게시물 이동</a></td>
	</tr>
</table>
<br>
<table align="center">
<tr><td>
<form action="admin_updatePoint.do" id="updatePointForm">
닉네임 : <input type="text" name="nick"><span id="nickCheck"></span>
&nbsp;&nbsp;&nbsp;&nbsp;<br>
증감여부 : <select name="operator">
	<option>---</option>
	<option value="plus">+</option>
	<option value="minus">-</option>
</select>
&nbsp;&nbsp;&nbsp;&nbsp;
포인트수치 : <input type="text" name="point">
<input type="submit"  value="등록">
</form>
</td></tr>
</table>
</body>
</html>